package mcsm.GUI.LeftPanel;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import javax.swing.ImageIcon;

import mcsm.GUI.LabelButton;
import mcsm.GUI.MyFrame;
import mcsm.GUI.RightPanel.RightPanel;
import mcsm.GUI.RightPanel.RightPanelFactory;
import mcsm.Model.VIP;

public class VipLeftPanel extends FunctionLeftPanel {
	VipLeftPanel(VIP vip, int width, int height, MyFrame frame) {
		super(vip,width, height, frame);
	}
	
	private class VipUpPanel extends FunctionUpPanel {
		public VipUpPanel(int width, int height) {
			super(width, height);
		}

	}
	
	private class VipDownPanel extends FunctionDownPanel {
		public VipDownPanel(int width, int height) {
			super(width, height);
			this.setButtons(1);
		}
		
		@Override
		protected int setOtherLabelsAndSetY() {
			ImageIcon bargain_nor = new ImageIcon(this.getClass().getResource("/SEED/icon/bargain_nor.gif"));
			ImageIcon bargain_sel = new ImageIcon(this.getClass().getResource("/SEED/icon/bargain_sel.gif"));
			
			LabelButton bargainB = new LabelButton(x, y, bargain_nor, bargain_sel, thisPanel);
			bargainB.addMouseListener(new BargainSearchButtonListener());
			increaceY();
			
			this.setLayout(null);	
			this.add(bargainB.getLabel());
			
			return y;
		}
	}
	
	protected UpPanel createUpPanel(int width, int height) {
		return new VipUpPanel(width, height);
	}
	
	protected DownPanel createDownPanel(int width, int height) {
		return new VipDownPanel(width, height);
	}
	
	private class BargainSearchButtonListener extends MouseAdapter {
		public void mouseClicked(MouseEvent e) {
			RightPanel rp = RightPanelFactory.createBargainSearchRightPanel(frame);
			frame.setRightPanel(rp);
		}	
	}

}
